# 装饰器模式
def decorator(fun):
    def inner():
        print("我要睡觉了。。。")
        fun()
        print("我要起床了。。。")

    return inner


@decorator
def sleep():
    import random, time
    print("睡眠中。。。")
    num = random.randint(1, 5)
    time.sleep(num)
    print("睡眠中。。。%d" % num)


# 单独调用
# sleep()

# sleep1 = decorator(sleep)
# sleep1()

# 单独调用
sleep()
